package com.kaigejava.juc;

import lombok.Data;

/**
 * @author kaigejava
 * 值传递和地址值传递
 */
public class TranTest {
    public  void test1(int age){
        age= 30;
    }
    public  void test2(User user){
        user.setName("司小司");
    }
    public  String test3(String str){
        str = "凯哥Java";
        return str;
    }
    public static void main(String[] args) {
        TranTest t1 = new TranTest();
        int age = 28;
        t1.test1(age);
        System.out.println("==输出1："+age);   //①
        User user = new User("凯哥Java");
        t1.test2(user);
        System.out.println("==输出2："+user.getName()); //②
        String str = "张三";
       str =  t1.test3(str);
        System.out.println("==输出3："+str); // 3

        String s1 = "哈哈";
        String s2 = new String ("哈哈");
        //问题：32 和32行 各 创建了几个对象
    }
}

@Data
class User{
    String name;
    public  User (String name){
        this.name = name;
    }
}
